package com.woniu.map.remote.url;

import com.woniu.internalcommon.constant.AmapConfigConstants;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class POISearchUrl {
    @Value("${map.key}")
    private String mapKey;



    /* https://restapi.amap.com/v5/place/around?location=116.473168,39.993015&radius=10000
    // &types=餐饮服务&key=7367d4e858a51c328ce549ac315007d0&sortrule=distance&show_fields=business,photos
     */
    public String buildAroundPOISearchUrl(String location, Integer radius, String types) {
        return new StringBuilder().append(AmapConfigConstants.POI_AROUND_SEARCH)
                .append("?").append("location=").append(location)
                .append("&").append("radius=").append(radius)
                .append("&").append("types=").append(types)
                .append("&").append("key=").append(mapKey)
                .append("&").append("page_size=").append("25")
                .append("&").append("sortrule=").append("weight")
                .append("&").append("show_fields=").append("business,photos").toString();
    }
}
